package com.ruoyi.listener;


import com.ruoyi.studylog.domain.UserStudyLog;
import com.ruoyi.studylog.service.IUserStudyLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Slf4j
@Service
public class RedisKeyTimeOutListener implements OrderRedisMessageListener {

@Autowired
private IUserStudyLogService logService;

    @OrderRedisListener(key = "study:",ext = "delete_order:")
    public void run(String key) {
   //结束
        Long l = Long.valueOf(key);
        UserStudyLog userStudyLog = logService.selectUserStudyLogById(l);
        userStudyLog.setStatus(1);
        logService.updateUserStudyLog(userStudyLog);
        //todo websocket 通知用户学习结束
    }
}
